[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
return return Statement
return [expression];
The return statement is used to terminate a user-defined function and
return control to the statement following the call. The return
statement may also be used to return a value.
Notes: If no value is returned, the return value is undefined.
Although it is a bad programming practice, it is possible
to return from multiple places in a function, returning a
value from some points, but not from others. This is sure
to bite you at some later time, and should be avoided.
The return expression is often written as return (value);
The parentheses aren't necessary, but they don't hurt
anything.
-------------------------------- Example ---------------------------------
if ( condition )
return; # Return value undefined
if ( condition )
return i; # Value of i is returned
if ( condition )
return ( i ); # As above; value of i is returned
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson